import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { InstallController } from './install/install.controller';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { ConfigModule } from '@nestjs/config';
import { databaseConfig } from './config/database';
import { DatabaseModule } from './module/database.module';

@Module({
  imports: [
    ServeStaticModule.forRoot({
      rootPath: join(process.cwd(), 'public'), // 静态资源目录
      exclude: [], // 排除API路由（可选）
      serveStaticOptions: {
        index: false, // 禁用目录索引（安全）
        redirect: false,
      },
    }),
    ConfigModule.forRoot({
      isGlobal: true,
      load: [databaseConfig],
    }),
    DatabaseModule,
  ],
  controllers: [AppController, InstallController],
  providers: [AppService],
})
export class AppModule {}
